#pragma once

#include <iostream>
#include <vector>

namespace MyBitset {
template <size_t N>
class bitset {
 public:
  bitset() { _bits.resize(N / 8 + 1, 0); }

  void set(size_t x) {
    size_t i = x / 8;
    size_t j = x % 8;
    /*第i个char中的第j个比特位*/
    _bits[i] |= (1 << j);  // 运算符优先级
  }

  void reset(size_t x) {
    
    size_t i = x / 8;
    size_t j = x % 8;
    _bits[i] &= ~(1 << j);
  }

  bool test(size_t x) {
    size_t i = x / 8;
    size_t j = x % 8;
    return _bits[i] & (1 << j);
  }

 private:
  std::vector<char> _bits;
};
}  // namespace MyBitset